<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8" %>
<%@ page import="java.util.*" %>
<%@ page import="com.sms.project.*" %>

<%--
	project/student/project.jsp
 --%>

<%	//清除内存
	response.setHeader("Pragma","No-cache"); 
	response.setHeader("Cache-Control","no-cache"); 
	response.setDateHeader("Expires", 0); 
%>

<%
	String progress = request.getParameter("progress");
	//System.out.println("progress" + progress);
	String select[] = new String[3];
	if(progress != null) {
		if(progress.trim().equals("already")) {
			select[0] = "selected";
		} else if(progress.trim().equals("unalready")){
			select[1] = "selected";
		} else {
			select[2] = "selected";
		}
	} else {
			select[2] = "selected";
	}
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<div style="margin:10px auto; width:600px; font-size:15px;">
项目进度：<select>
	<option value="all" <%= select[2] %>>全部</option>
	<option value="already" <%= select[0] %>>已完成</option>
	<option value="unalready" <%= select[1] %>>未完成</option>
</select>
<input type="submit"  id='pro-search'  value="搜索" />
</div>

<form onSubmit="return false" id="all-project">
<table class="project" cellpadding="0" cellspacing="0">
</table>
</form>
<div id="dd"></div>
<div id="aa"></div>
<script type="text/javascript">
$('.project').datagrid({
	url:'project/student/query-project.jsp?progress=' + $('select option:selected').attr('value'), //返回数据的链接
	columns:[[
			{field:'code',title:'项目编号',width:100},
			{field:'name',title:'项目名称',width:220},
			{field:'status',title:'项目进度',width:100},
			{field:'prodetail',title:'详细信息',width:100},
			{field:'repdetail',title:'任务/信息交流',width:100},	
		]],
	pagination:true,
	onDblClickCell:function(rowIndex, field, value){
		$(this).click(function(){
		$(this).css("color","red");
		$('#dd').dialog({
			  onClose:function(){
				$("td").css("color","black");  
			  }
		});
		})
		if(field=='prodetail'){
			 $('#dd').dialog({
		         title:"项目详情",
				 zIndex:9001,
				 width:820, height:490,
				 top:140,left:365,
				 cache:false,
				 resizable:true,
				href:'project/student/item-details.jsp?row='+rowIndex + '&progress=' + $('select option:selected').attr('value'),
		   });
		   		$('#dd').dialog('refresh','project/student/item-details.jsp?row='+rowIndex + '&progress=' + $('select option:selected').attr('value'))
			}
		   else if(field=='repdetail'){
			    $('#dd').dialog({
		         title:"汇报详情",
				 zIndex:9001,
				 width:820, height:490,
				 top:140,left:365,
				 maximizable:true,
				 cache:false,
				 resizable:true,
				href:'project/student/report-detail.jsp?row='+rowIndex + '&progress=' + $('select option:selected').attr('value'), 
		   });
		   		$('#dd').dialog('refresh','project/student/report-detail.jsp?row='+rowIndex + '&progress=' + $('select option:selected').attr('value'))
			   }
	}

})

/*项目详情*/
$('.datagrid-body tr').each(function(){
	$('this').children().eq(3).click(function(){
		$(this).css("color","red");
		$('#dd').dialog({
			  onClose:function(){
				$("td").css("color","black");  
			  }
		});
		 $('#dd').dialog({
		         title:"项目详情",
				 zIndex:9001,
				 width:820, height:490,
				 top:140,left:365,
				 cache:false,
				 resizable:true,
				href:'project/headman/item-details.jsp'
		   });
		});
	})
	
/*项目任务*/
$('.datagrid-body tr').each(function(){
	$('this').children().eq(5).click(function(){
		$(this).css("color","red");
		$('#dd').dialog({
			  onClose:function(){
				$("td").css("color","black");  
			  }
		});
		  if($(this).text()=='项目任务管理'){
			  $('#dd').dialog({
				         title:"项目任务管理",
						  zIndex:9001,
						 width:820, height:490,
				 		top:140,left:365,
						 cache:false,
						  resizable:true,
						href:'project/headman/task.jsp' //注意变量i的传输
						 });
			} else if($(this).text()=='项目任务查看'){
			   $('#dd').dialog({
				         title:"项目任务查看",
						  zIndex:9001,
						width:820, height:490,
				 		top:140,left:365,
						 cache:false,
						  resizable:true,
						href:'project/headman/my-task.html' //注意变量的传输
						 });
			  }
			
		});
	})	
	
/*汇报详情*/
$('.datagrid-body tr').each(function(){
	$('this').children().eq(6).click(function(){
		$(this).css("color","red");
		$('#dd').dialog({
			  onClose:function(){
				$("td").css("color","black");  
			  }
		});  
		if($(this).text()=='添加汇报'){
			  $('#dd').dialog({
				         title:"汇报添加",
						  zIndex:9001,
						 width:820, height:490,
				 		top:140,left:365,
						 cache:false,
						  resizable:true,
						href:'project/headman/report-add.jsp?row=' + i //注意变量i的传输
						 });
		  }
		  else if($(this).text()=='汇报管理'){
			   $('#dd').dialog({
				         title:"汇报管理",
						  zIndex:9001,
						 width:820, height:490,
				 		top:140,left:365,
						 cache:false,
						  resizable:true,
						href:'project/student/report-details.jsp?row=' + i //注意变量i的传输
						 });
		  }
				
		});
	})	
	
/*搜索处理*/
$("#pro-search").click(function(){
	var tab = $(".easyui-tabs").tabs('getSelected');;
			 		$(".easyui-tabs").tabs('update',
			                        {tab:tab,
									options:{
								      cache:false,
                                      href:'project/student/project.jsp?progress=' + $('select option:selected').attr('value')}
									}
									);  /*更新面板*/	
		
	})
</script>
</body>
